package cn.alm.springbootintegration.controller;

import dev.langchain4j.model.chat.ChatModel;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("llm")
public class LLMController {

    private ChatModel chatModel;

    public LLMController(ChatModel chatModel) {
        this.chatModel = chatModel;
    }

    @GetMapping("chat")
    public String chat(@RequestParam(value = "message", defaultValue = "你是谁？") String message) {
        return chatModel.chat(message);
    }

}
